CallbackHandler Overview

The CallbackHandler allows users to receive a status callback informing the listener if an error exists or if the generation process is complete, if desired, by creating an endpoint that implements our specified type for callbacks. If they choose to not implement a callback endpoint, documents can be retrieved using a polling method through the corresponding Get method.

External Callback Overview

Users supply the Callback URL, Username, and Password with the Generate, SelectAndGenerate, or SelectGenerateDeliver API to integrate with IEDocService in Expere Document Services.

To use callbacks with any of Generate API's, integrators should implement "HandleUpdate" method for the "IStatusUpdateSink" interface. To use callbacks with the delivery service, integrators should implement the “FulfillmentDeliveryResponse” method of the "IDeliveryResponse" interface.

The delivery service uses "IStatusUpdateSink" to display a CallbackHandler Type of "GenerateUpdate." To use callbacks with Select And Generate API's, integrators should implement "HandleUpdate" for "IStatusUpdateSink." The interface is: DocServices.Common.Interfaces.V2.Data.StatusUpdate



Integrating with the CallbackHandler interface

public class MyDocGenCallbackService : IStatusUpdateSink
{
 private readonly string _callbackLogLocation = WebConfigurationManager.AppSettings["CallbackLogLocation"];

public Task HandleUpdate(DocServices.Common.Interfaces.V2.Data.StatusUpdate update)
 {
 if (!Directory.Exists(_callbackLogLocation))
 {
 DirectoryInfo di = Directory.CreateDirectory(_callbackLogLocation);
 }
 var writeToFile = new List<string>();
 writeToFile.Add("************************************************");
 writeToFile.Add(DateTime.Now + " ---> " + update.TransactionIdentifier + " - Combined DocGen Callback Received");
 writeToFile.Add(DateTime.Now + " ---> " + update.TransactionIdentifier + " - Update Type: " +
 update.UpdateType);
 writeToFile.Add(DateTime.Now + " ---> " + update.TransactionIdentifier + " - Description: " +
 update.Description);
 writeToFile.Add(DateTime.Now + " ---> " + update.TransactionIdentifier + " - DocGen TimeStamp: " +
 update.TimeStamp);
 File.AppendAllLines(_callbackLogLocation + @"\" + "DocGenCallbacks.txt", writeToFile);
 return null;
 }
}

Sample Callback Handler Scenario (SelectAndGenerate)

CallbackHandler:
Type = GenerateUpdate
Description = Always blank.
DeliverResponseService: NA

SelectGenerateDeliver Callback Overview

Users supply the Callback URL, Username, and Password with the SelectGenerateDeliver API to integrate with IEDocService in Expere Document Services.

The SelectGenerateDeliver method utilizes two callbacks:

  • "IStatusUpdateSink" alerts the user to any errors consisting of the error status and description.
  • "IDeliveryResponse" provides status updates as the package advances through the print fulfillment process.

To receive both callbacks above, integrators must implement both interfaces on the same endpoint.